package com.neuedu.yyzx.framework;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;

@RestControllerAdvice
public class ExceptionController {
    @ExceptionHandler(value=Exception.class)
    public Res ex(Exception ex){
        ex.printStackTrace();
        if(ex instanceof NoHandlerFoundException){
            return Res.failed(404,"请求路径不正确");
        }

        return  Res .failed(ex.getMessage());
    }
}
